#ifndef FUR_HELPERS_INCLUDED
#define FUR_HELPERS_INCLUDED

#include "UnityCG.cginc"
			
struct v2f {
	V2F_POS_FOG;
	float4 color : COLOR0;
	float4 uv : TEXCOORD0;
	float4 uv1 : TEXCOORD1;
};

struct appdata_baseX {
	float4 vertex : POSITION;
	float3 normal : NORMAL;
	float4 texcoord : TEXCOORD0;
	
};

uniform float4 _Color;
uniform float _Size;
samplerRECT _GrabTexture : register(s0);
float4 _GrabTexture_TexelSize;
sampler2D _MainTex : register(s1);

float4 frag (v2f i) : COLOR
{		
	float4 texcol = tex2D( _MainTex, i.uv1.xy );
	float a = texcol.a;
	float3 texsize = float3(_Size,_Size,0) * a * i.uv.w; //* float3(_GrabTexture_TexelSize.xy, 0);
	float3 texsize2 = texsize;
	texsize2.y=-texsize2.y;
	
	float4 blur = (texRECTproj( _GrabTexture, i.uv.xyw +texsize)+texRECTproj( _GrabTexture, i.uv.xyw -texsize)+texRECTproj( _GrabTexture, i.uv.xyw +texsize2)+texRECTproj( _GrabTexture, i.uv.xyw -texsize2))/4;
	
	texcol.a=1;
	blur.a=1;
	half4 c = blur*(1-a)*sqrt(a)+texcol*a;
	//return float4(i.uv.www/30,1);
	return c;
}

#endif

